
from selenium.webdriver.common.by import By
import time
from page_object.basepage import BasePage
from page_object.login_page import Login

""" 首页"""

class FirstPage(BasePage):

    def firstpage(self):
        self.find_element(By.CSS_SELECTOR,"#J_Nav > li.nav-item.dl-selected > div.nav-item-inner.nav-home").click()
        frame_ele = self.find_element(By.CSS_SELECTOR, ".tab-content > iframe:nth-child(1)")
        self.swith_to_frame(frame_ele)
        time.sleep(2)
        user_num = self.find_element(By.CSS_SELECTOR,"body > div > div > div > div:nth-child(1)").text
        time.sleep(2)
        download_num = self.find_element(By.CSS_SELECTOR,"body > div > div > div > div:nth-child(2)").text
        time.sleep(2)
        call_num = self.find_element(By.CSS_SELECTOR,"body > div > div > div > div:nth-child(3)").text
        print(user_num)
        print(download_num)
        print(call_num)
        print("*"*20,"\n\n")
        self.switch_to_parentframe()

if __name__ == "__main__":
    from selenium import webdriver

    driver = webdriver.Firefox()
    driver.get("http://javaweb.aroundme.tv:8083/Testhuaxi/login.jsp")
    login_ = Login(driver)
    login_.login()
    fp = FirstPage(driver)
    fp.firstpage()

